/*
 * This file is part of quickLoad, a software for gamers
 *
 * Copyright (C) 2005-2008 Lucas Romero
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Net;
using System.Resources;
using System.Windows.Forms;
using ESLFileUploader;
using Org.Mentalis.Utilities;
using QuickLoad.UI;
using XPExplorerBar;
using XPTable;
using XPTable.Editors;
using XPTable.Events;
using XPTable.Models;
using Padding=System.Windows.Forms.Padding;
using QuickLoad;

namespace QuickLoad
{
	/// <summary>
	/// Zusammenfassung fr Form1.
	/// </summary>
	public class FormMain : Form
	{
		//private XPTable.Renderers.GradientHeaderRenderer gradientRenderer = new XPTable.Renderers.GradientHeaderRenderer();
		//private int Xtmp=0;
		//private int Ytmp=0;
		//UInt32 BytesUploaded;
		//UInt32 ScreensUploaded;
		//UInt32 DemosUploaded;
		public bool uploading=false;
		//Point SavedPosition1,SavedPosition2;
		//int SavedHeight,SavedWidth;
		string match=string.Empty;
		ResourceManager rm,lang;
		private CultureInfo culture;
        //ESLFileUploader.Uploader.CustomLogCommand cl = new ESLFileUploader.Uploader.CustomLogCommand(AddText);
		private ContextMenuStrip FileMenu;
        private ToolStripMenuItem miExit2;
        private IContainer components;
        private ToolStripMenuItem miStartUpload;
		private Timer uptimer;
        private ToolStripMenuItem miShowLog;
        private FormUploadData data = new FormUploadData();
        private ToolStripMenuItem miSettings;
        public Settings settings;
        private ToolStripMenuItem miUploadStats;
		private ColumnModel columnModel1;
		private TableModel tableModel1;
		private TextColumn tSize;
		private ProgressBarColumn pProgress;
		private ComboBoxColumn cName;
		private TextColumn tSpeed;
		private TextColumn tTimeRemaining;
		private TextColumn tStatus;
		private ImageColumn iType;
		private ImageColumn iStatus;
        private ToolStripMenuItem miRemoveUploaded;
        private ToolStripMenuItem miCancelUpload;
        private TaskPane taskPane1;
        private Label label1;
		private TaskItem tiSettings;
		private Expando expView;
		private TaskItem tiRemoveCompleted;
		private Expando expTasks;
		private TaskItem tiStartUpload;
		private TaskItem tiShowLog;
		private TaskItem tiReportBugs;
		private TaskItem tiClearList;
		private Expando expStatus;
		private XPListView tiRecentReplays;
		private ColumnHeader RecRepName;
        private ColumnHeader RecRepDate;
        internal Expando expRecentFiles;
		private CheckBox tiDoShutdown;
        private TaskItem tiSpeed;
        private TaskItem tiStatistics;
        private TaskItem tiAbout;
        internal Panel pRecentFilesHint;
        private Label lRecentFilesHint;
        private Button bRecentFilesHintDismiss;
        private TaskItem tiUploadAssistant;
        private Timer timerImageHide;
        private SplitContainer splitContainer1;
        private PictureBox BigImage;
        private Table table1;
        private FlowLayoutPanel flowLayoutPanel1;
        private Splitter MenuSizer;
        private TaskItem tiRefreshRecentFiles;
        PictureBox ToolTipImage = new PictureBox();
        Controls.PreviewToolTip tooltip;
        private TaskItem tiSuccessfulFileList;
        internal AutoUpdater.AutoUpdateChecker upd =
                new AutoUpdater.AutoUpdateChecker();
        private ToolStripSeparator toolStripSeparator1;
        private ToolStripSeparator toolStripSeparator2;
        private ToolStripSeparator toolStripSeparator3;
		Uploader up = null;
		//private Blue.Windows.StickyWindow sticky;

		public FormMain()
		{
			//
			// Erforderlich fr die Windows Form-Designeruntersttzung
			//
			InitializeComponent();
			//sticky = new Blue.Windows.StickyWindow(this);
			//
			// TODO: Fgen Sie den Konstruktorcode nach dem Aufruf von InitializeComponent hinzu
			//
		}

		/// <summary>
		/// Die verwendeten Ressourcen bereinigen.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Vom Windows Form-Designer generierter Code
		/// <summary>
		/// Erforderliche Methode fr die Designeruntersttzung. 
		/// Der Inhalt der Methode darf nicht mit dem Code-Editor gendert werden.
		/// </summary>
		private void InitializeComponent()
		{
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
            System.Windows.Forms.ListViewGroup listViewGroup7 = new System.Windows.Forms.ListViewGroup("Screenshots", System.Windows.Forms.HorizontalAlignment.Left);
            System.Windows.Forms.ListViewGroup listViewGroup8 = new System.Windows.Forms.ListViewGroup("Replays", System.Windows.Forms.HorizontalAlignment.Left);
            System.Windows.Forms.ListViewGroup listViewGroup9 = new System.Windows.Forms.ListViewGroup("Aequitas", System.Windows.Forms.HorizontalAlignment.Left);
            this.FileMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.miStartUpload = new System.Windows.Forms.ToolStripMenuItem();
            this.miCancelUpload = new System.Windows.Forms.ToolStripMenuItem();
            this.miRemoveUploaded = new System.Windows.Forms.ToolStripMenuItem();
            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this.miShowLog = new System.Windows.Forms.ToolStripMenuItem();
            this.miUploadStats = new System.Windows.Forms.ToolStripMenuItem();
            this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
            this.miSettings = new System.Windows.Forms.ToolStripMenuItem();
            this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
            this.miExit2 = new System.Windows.Forms.ToolStripMenuItem();
            this.uptimer = new System.Windows.Forms.Timer(this.components);
            this.columnModel1 = new XPTable.Models.ColumnModel();
            this.iStatus = new XPTable.Models.ImageColumn();
            this.cName = new XPTable.Models.ComboBoxColumn();
            this.iType = new XPTable.Models.ImageColumn();
            this.tSize = new XPTable.Models.TextColumn();
            this.tStatus = new XPTable.Models.TextColumn();
            this.pProgress = new XPTable.Models.ProgressBarColumn();
            this.tSpeed = new XPTable.Models.TextColumn();
            this.tTimeRemaining = new XPTable.Models.TextColumn();
            this.tableModel1 = new XPTable.Models.TableModel();
            this.timerImageHide = new System.Windows.Forms.Timer(this.components);
            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
            this.BigImage = new System.Windows.Forms.PictureBox();
            this.table1 = new XPTable.Models.Table();
            this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
            this.MenuSizer = new System.Windows.Forms.Splitter();
            this.taskPane1 = new XPExplorerBar.TaskPane();
            this.expTasks = new XPExplorerBar.Expando();
            this.tiStartUpload = new XPExplorerBar.TaskItem();
            this.tiSettings = new XPExplorerBar.TaskItem();
            this.tiShowLog = new XPExplorerBar.TaskItem();
            this.tiSuccessfulFileList = new XPExplorerBar.TaskItem();
            this.tiUploadAssistant = new XPExplorerBar.TaskItem();
            this.tiReportBugs = new XPExplorerBar.TaskItem();
            this.tiStatistics = new XPExplorerBar.TaskItem();
            this.tiAbout = new XPExplorerBar.TaskItem();
            this.expStatus = new XPExplorerBar.Expando();
            this.tiSpeed = new XPExplorerBar.TaskItem();
            this.tiDoShutdown = new System.Windows.Forms.CheckBox();
            this.expView = new XPExplorerBar.Expando();
            this.tiClearList = new XPExplorerBar.TaskItem();
            this.tiRemoveCompleted = new XPExplorerBar.TaskItem();
            this.expRecentFiles = new XPExplorerBar.Expando();
            this.tiRecentReplays = new XPExplorerBar.XPListView();
            this.RecRepName = new System.Windows.Forms.ColumnHeader();
            this.RecRepDate = new System.Windows.Forms.ColumnHeader();
            this.pRecentFilesHint = new System.Windows.Forms.Panel();
            this.bRecentFilesHintDismiss = new System.Windows.Forms.Button();
            this.lRecentFilesHint = new System.Windows.Forms.Label();
            this.tiRefreshRecentFiles = new XPExplorerBar.TaskItem();
            this.label1 = new System.Windows.Forms.Label();
            this.FileMenu.SuspendLayout();
            this.splitContainer1.Panel1.SuspendLayout();
            this.splitContainer1.Panel2.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.BigImage)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.table1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.taskPane1)).BeginInit();
            this.taskPane1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.expTasks)).BeginInit();
            this.expTasks.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.expStatus)).BeginInit();
            this.expStatus.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.expView)).BeginInit();
            this.expView.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.expRecentFiles)).BeginInit();
            this.expRecentFiles.SuspendLayout();
            this.pRecentFilesHint.SuspendLayout();
            this.SuspendLayout();
            // 
            // FileMenu
            // 
            this.FileMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.miStartUpload,
            this.miCancelUpload,
            this.miRemoveUploaded,
            this.toolStripSeparator1,
            this.miShowLog,
            this.miUploadStats,
            this.toolStripSeparator2,
            this.miSettings,
            this.toolStripSeparator3,
            this.miExit2});
            this.FileMenu.Name = "FileMenu";
            this.FileMenu.Size = new System.Drawing.Size(194, 176);
            this.FileMenu.Opening += new System.ComponentModel.CancelEventHandler(this.FileMenu_Popup);
            // 
            // miStartUpload
            // 
            this.miStartUpload.Image = global::QuickLoad.Images.Upload_16;
            this.miStartUpload.Name = "miStartUpload";
            this.miStartUpload.Size = new System.Drawing.Size(193, 22);
            this.miStartUpload.Text = "Start Upload";
            this.miStartUpload.Click += new System.EventHandler(this.miStartUpload_Click);
            // 
            // miCancelUpload
            // 
            this.miCancelUpload.Image = global::QuickLoad.Images.Delete_16;
            this.miCancelUpload.Name = "miCancelUpload";
            this.miCancelUpload.Size = new System.Drawing.Size(193, 22);
            this.miCancelUpload.Text = "Cancel Upload";
            this.miCancelUpload.Visible = false;
            this.miCancelUpload.Click += new System.EventHandler(this.miCancelUpload_Click);
            // 
            // miRemoveUploaded
            // 
            this.miRemoveUploaded.Image = global::QuickLoad.Images.Check_16;
            this.miRemoveUploaded.Name = "miRemoveUploaded";
            this.miRemoveUploaded.Size = new System.Drawing.Size(193, 22);
            this.miRemoveUploaded.Text = "Remove uploaded files";
            this.miRemoveUploaded.Click += new System.EventHandler(this.miRemoveUploaded_Click);
            // 
            // toolStripSeparator1
            // 
            this.toolStripSeparator1.Name = "toolStripSeparator1";
            this.toolStripSeparator1.Size = new System.Drawing.Size(190, 6);
            // 
            // miShowLog
            // 
            this.miShowLog.Image = global::QuickLoad.Images.tiShowLog_Image;
            this.miShowLog.Name = "miShowLog";
            this.miShowLog.Size = new System.Drawing.Size(193, 22);
            this.miShowLog.Text = "Show Log";
            this.miShowLog.Visible = false;
            this.miShowLog.Click += new System.EventHandler(this.miShowLog_Click);
            // 
            // miUploadStats
            // 
            this.miUploadStats.Image = global::QuickLoad.Images.tiStatistics_Image;
            this.miUploadStats.Name = "miUploadStats";
            this.miUploadStats.Size = new System.Drawing.Size(193, 22);
            this.miUploadStats.Text = "Upload Statistics";
            this.miUploadStats.Click += new System.EventHandler(this.tiStatistics_Click);
            // 
            // toolStripSeparator2
            // 
            this.toolStripSeparator2.Name = "toolStripSeparator2";
            this.toolStripSeparator2.Size = new System.Drawing.Size(190, 6);
            // 
            // miSettings
            // 
            this.miSettings.Image = global::QuickLoad.Images.tiSettings_Image;
            this.miSettings.Name = "miSettings";
            this.miSettings.Size = new System.Drawing.Size(193, 22);
            this.miSettings.Text = "Settings";
            this.miSettings.Click += new System.EventHandler(this.miSettings_Click);
            // 
            // toolStripSeparator3
            // 
            this.toolStripSeparator3.Name = "toolStripSeparator3";
            this.toolStripSeparator3.Size = new System.Drawing.Size(190, 6);
            // 
            // miExit2
            // 
            this.miExit2.Image = global::QuickLoad.Images.Exit;
            this.miExit2.Name = "miExit2";
            this.miExit2.Size = new System.Drawing.Size(193, 22);
            this.miExit2.Text = "Exit";
            this.miExit2.Click += new System.EventHandler(this.miExit_Click);
            // 
            // uptimer
            // 
            this.uptimer.Interval = 250;
            this.uptimer.Tick += new System.EventHandler(this.uptimer_Tick);
            // 
            // columnModel1
            // 
            this.columnModel1.Columns.AddRange(new XPTable.Models.Column[] {
            this.iStatus,
            this.cName,
            this.iType,
            this.tSize,
            this.tStatus,
            this.pProgress,
            this.tSpeed,
            this.tTimeRemaining});
            // 
            // iStatus
            // 
            this.iStatus.Alignment = XPTable.Models.ColumnAlignment.Center;
            this.iStatus.DrawText = false;
            this.iStatus.Width = 20;
            // 
            // cName
            // 
            this.cName.Image = global::QuickLoad.Images.Rename_16;
            this.cName.Text = "Name";
            this.cName.Width = 100;
            // 
            // iType
            // 
            this.iType.Image = ((System.Drawing.Image)(resources.GetObject("iType.Image")));
            this.iType.Text = "Type";
            this.iType.Width = 100;
            // 
            // tSize
            // 
            this.tSize.Editable = false;
            this.tSize.Image = ((System.Drawing.Image)(resources.GetObject("tSize.Image")));
            this.tSize.Text = "Size";
            // 
            // tStatus
            // 
            this.tStatus.Editable = false;
            this.tStatus.Image = global::QuickLoad.Images.Help_16;
            this.tStatus.Text = "Status";
            this.tStatus.Width = 150;
            // 
            // pProgress
            // 
            this.pProgress.Image = ((System.Drawing.Image)(resources.GetObject("pProgress.Image")));
            this.pProgress.Text = "Progress";
            // 
            // tSpeed
            // 
            this.tSpeed.Editable = false;
            this.tSpeed.Image = global::QuickLoad.Images.Upload_16;
            this.tSpeed.Text = "Speed";
            // 
            // tTimeRemaining
            // 
            this.tTimeRemaining.Editable = false;
            this.tTimeRemaining.Image = global::QuickLoad.Images.Time_16;
            this.tTimeRemaining.Text = "ETA";
            // 
            // tableModel1
            // 
            this.tableModel1.RowHeight = 20;
            // 
            // timerImageHide
            // 
            this.timerImageHide.Interval = 2000;
            this.timerImageHide.Tick += new System.EventHandler(this.timerImageHide_Tick);
            // 
            // splitContainer1
            // 
            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.splitContainer1.Location = new System.Drawing.Point(257, 0);
            this.splitContainer1.Name = "splitContainer1";
            this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
            // 
            // splitContainer1.Panel1
            // 
            this.splitContainer1.Panel1.Controls.Add(this.BigImage);
            this.splitContainer1.Panel1.Controls.Add(this.table1);
            // 
            // splitContainer1.Panel2
            // 
            this.splitContainer1.Panel2.Controls.Add(this.flowLayoutPanel1);
            this.splitContainer1.Panel2Collapsed = true;
            this.splitContainer1.Size = new System.Drawing.Size(672, 457);
            this.splitContainer1.SplitterDistance = 319;
            this.splitContainer1.TabIndex = 9;
            // 
            // BigImage
            // 
            this.BigImage.Location = new System.Drawing.Point(19, 32);
            this.BigImage.Name = "BigImage";
            this.BigImage.Size = new System.Drawing.Size(100, 50);
            this.BigImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
            this.BigImage.TabIndex = 13;
            this.BigImage.TabStop = false;
            this.BigImage.Visible = false;
            this.BigImage.Click += new System.EventHandler(this.BigImage_Click);
            this.BigImage.MouseMove += new System.Windows.Forms.MouseEventHandler(this.BigImage_MouseMove);
            this.BigImage.DragEnter += new System.Windows.Forms.DragEventHandler(this.BigImage_DragEnter);
            this.BigImage.MouseEnter += new System.EventHandler(this.BigImage_MouseEnter);
            // 
            // table1
            // 
            this.table1.AllowDrop = true;
            this.table1.BackColor = System.Drawing.SystemColors.Window;
            this.table1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("table1.BackgroundImage")));
            this.table1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
            this.table1.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.table1.ColumnModel = this.columnModel1;
            this.table1.ContextMenuStrip = this.FileMenu;
            this.table1.CustomEditKey = System.Windows.Forms.Keys.F2;
            this.table1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.table1.EditStartAction = XPTable.Editors.EditStartAction.SingleClick;
            this.table1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.table1.FullRowSelect = true;
            this.table1.HeaderFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.table1.Location = new System.Drawing.Point(0, 0);
            this.table1.Name = "table1";
            this.table1.NoItemsText = "Drag & Drop files here";
            this.table1.Size = new System.Drawing.Size(672, 457);
            this.table1.SortedColumnBackColor = System.Drawing.Color.Transparent;
            this.table1.TabIndex = 11;
            this.table1.TableModel = this.tableModel1;
            this.table1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.table1_KeyDown);
            this.table1.DragDrop += new System.Windows.Forms.DragEventHandler(this.table1_DragDrop);
            this.table1.BeginEditing += new XPTable.Events.CellEditEventHandler(this.table1_BeginEditing);
            this.table1.DoubleClick += new System.EventHandler(this.table1_DoubleClick);
            this.table1.DragEnter += new System.Windows.Forms.DragEventHandler(this.table1_DragEnter);
            // 
            // flowLayoutPanel1
            // 
            this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
            this.flowLayoutPanel1.Name = "flowLayoutPanel1";
            this.flowLayoutPanel1.Size = new System.Drawing.Size(150, 46);
            this.flowLayoutPanel1.TabIndex = 13;
            this.flowLayoutPanel1.WrapContents = false;
            // 
            // MenuSizer
            // 
            this.MenuSizer.Location = new System.Drawing.Point(257, 0);
            this.MenuSizer.Name = "MenuSizer";
            this.MenuSizer.Size = new System.Drawing.Size(3, 457);
            this.MenuSizer.TabIndex = 10;
            this.MenuSizer.TabStop = false;
            // 
            // taskPane1
            // 
            this.taskPane1.AllowExpandoDragging = true;
            this.taskPane1.AutoScroll = true;
            this.taskPane1.AutoScrollMargin = new System.Drawing.Size(5, 5);
            this.taskPane1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.taskPane1.CustomSettings.GradientEndColor = System.Drawing.SystemColors.GradientInactiveCaption;
            this.taskPane1.CustomSettings.GradientStartColor = System.Drawing.SystemColors.GradientActiveCaption;
            this.taskPane1.CustomSettings.WatermarkAlignment = System.Drawing.ContentAlignment.TopCenter;
            this.taskPane1.Dock = System.Windows.Forms.DockStyle.Left;
            this.taskPane1.Expandos.AddRange(new XPExplorerBar.Expando[] {
            this.expTasks,
            this.expStatus,
            this.expView,
            this.expRecentFiles});
            this.taskPane1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.taskPane1.Location = new System.Drawing.Point(0, 0);
            this.taskPane1.Margin = new System.Windows.Forms.Padding(1);
            this.taskPane1.Name = "taskPane1";
            this.taskPane1.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.taskPane1.Size = new System.Drawing.Size(257, 457);
            this.taskPane1.TabIndex = 8;
            this.taskPane1.Text = "taskPane1";
            this.taskPane1.VisibleChanged += new System.EventHandler(this.taskPane1_VisibleChanged);
            this.taskPane1.SizeChanged += new System.EventHandler(this.taskPane1_SizeChanged);
            // 
            // expTasks
            // 
            this.expTasks.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.expTasks.Animate = true;
            this.expTasks.AutoLayout = true;
            this.expTasks.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.expTasks.CustomHeaderSettings.NormalGradientEndColor = System.Drawing.Color.White;
            this.expTasks.CustomHeaderSettings.NormalGradientStartColor = System.Drawing.Color.DarkOrange;
            this.expTasks.CustomHeaderSettings.SpecialGradientEndColor = System.Drawing.Color.White;
            this.expTasks.CustomHeaderSettings.SpecialGradientStartColor = System.Drawing.Color.DarkOrange;
            this.expTasks.CustomHeaderSettings.TitleFont = new System.Drawing.Font("Verdana", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.expTasks.CustomHeaderSettings.TitleGradient = true;
            this.expTasks.CustomSettings.WatermarkAlignment = System.Drawing.ContentAlignment.MiddleCenter;
            this.expTasks.ExpandedHeight = 224;
            this.expTasks.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.expTasks.ForeColor = System.Drawing.SystemColors.ControlText;
            this.expTasks.Items.AddRange(new System.Windows.Forms.Control[] {
            this.tiStartUpload,
            this.tiSettings,
            this.tiShowLog,
            this.tiSuccessfulFileList,
            this.tiUploadAssistant,
            this.tiReportBugs,
            this.tiStatistics,
            this.tiAbout});
            this.expTasks.Location = new System.Drawing.Point(7, 7);
            this.expTasks.Margin = new System.Windows.Forms.Padding(1);
            this.expTasks.Name = "expTasks";
            this.expTasks.Size = new System.Drawing.Size(228, 224);
            this.expTasks.TabIndex = 0;
            this.expTasks.Text = "Tasks";
            this.expTasks.TitleImage = ((System.Drawing.Image)(resources.GetObject("expTasks.TitleImage")));
            // 
            // tiStartUpload
            // 
            this.tiStartUpload.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.tiStartUpload.BackColor = System.Drawing.Color.Transparent;
            this.tiStartUpload.CustomSettings.LinkColor = System.Drawing.Color.LimeGreen;
            this.tiStartUpload.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tiStartUpload.Image = ((System.Drawing.Image)(resources.GetObject("tiStartUpload.Image")));
            this.tiStartUpload.Location = new System.Drawing.Point(12, 58);
            this.tiStartUpload.Name = "tiStartUpload";
            this.tiStartUpload.Size = new System.Drawing.Size(204, 16);
            this.tiStartUpload.TabIndex = 1;
            this.tiStartUpload.Text = "Start upload";
            this.tiStartUpload.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.tiStartUpload.UseVisualStyleBackColor = false;
            this.tiStartUpload.Click += new System.EventHandler(this.miStartUpload_Click);
            // 
            // tiSettings
            // 
            this.tiSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.tiSettings.BackColor = System.Drawing.Color.Transparent;
            this.tiSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tiSettings.Image = ((System.Drawing.Image)(resources.GetObject("tiSettings.Image")));
            this.tiSettings.Location = new System.Drawing.Point(12, 78);
            this.tiSettings.Name = "tiSettings";
            this.tiSettings.Size = new System.Drawing.Size(204, 16);
            this.tiSettings.TabIndex = 3;
            this.tiSettings.Text = "Configure settings";
            this.tiSettings.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.tiSettings.UseVisualStyleBackColor = false;
            this.tiSettings.Click += new System.EventHandler(this.miSettings_Click);
            // 
            // tiShowLog
            // 
            this.tiShowLog.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.tiShowLog.BackColor = System.Drawing.Color.Transparent;
            this.tiShowLog.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tiShowLog.Image = ((System.Drawing.Image)(resources.GetObject("tiShowLog.Image")));
            this.tiShowLog.Location = new System.Drawing.Point(12, 98);
            this.tiShowLog.Name = "tiShowLog";
            this.tiShowLog.Size = new System.Drawing.Size(204, 16);
            this.tiShowLog.TabIndex = 2;
            this.tiShowLog.Text = "Show log";
            this.tiShowLog.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.tiShowLog.UseVisualStyleBackColor = false;
            this.tiShowLog.Click += new System.EventHandler(this.miShowLog_Click);
            // 
            // tiSuccessfulFileList
            // 
            this.tiSuccessfulFileList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.tiSuccessfulFileList.BackColor = System.Drawing.Color.Transparent;
            this.tiSuccessfulFileList.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tiSuccessfulFileList.Image = global::QuickLoad.Images.Check_16;
            this.tiSuccessfulFileList.Location = new System.Drawing.Point(12, 118);
            this.tiSuccessfulFileList.Name = "tiSuccessfulFileList";
            this.tiSuccessfulFileList.Size = new System.Drawing.Size(204, 16);
            this.tiSuccessfulFileList.TabIndex = 8;
            this.tiSuccessfulFileList.Text = "Show all uploaded files";
            this.tiSuccessfulFileList.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.tiSuccessfulFileList.UseVisualStyleBackColor = false;
            this.tiSuccessfulFileList.Click += new System.EventHandler(this.tiSuccessfulFileList_Click);
            // 
            // tiUploadAssistant
            // 
            this.tiUploadAssistant.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.tiUploadAssistant.BackColor = System.Drawing.Color.Transparent;
            this.tiUploadAssistant.Enabled = false;
            this.tiUploadAssistant.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tiUploadAssistant.Image = global::QuickLoad.Images.Wizard_16;
            this.tiUploadAssistant.Location = new System.Drawing.Point(12, 138);
            this.tiUploadAssistant.Name = "tiUploadAssistant";
            this.tiUploadAssistant.Size = new System.Drawing.Size(204, 16);
            this.tiUploadAssistant.TabIndex = 7;
            this.tiUploadAssistant.Text = "Upload Assistant";
            this.tiUploadAssistant.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.tiUploadAssistant.UseVisualStyleBackColor = false;
            // 
            // tiReportBugs
            // 
            this.tiReportBugs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.tiReportBugs.BackColor = System.Drawing.Color.Transparent;
            this.tiReportBugs.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tiReportBugs.Image = ((System.Drawing.Image)(resources.GetObject("tiReportBugs.Image")));
            this.tiReportBugs.Location = new System.Drawing.Point(12, 158);
            this.tiReportBugs.Name = "tiReportBugs";
            this.tiReportBugs.Size = new System.Drawing.Size(204, 16);
            this.tiReportBugs.TabIndex = 4;
            this.tiReportBugs.Text = "Report bugs";
            this.tiReportBugs.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.tiReportBugs.UseVisualStyleBackColor = false;
            this.tiReportBugs.Click += new System.EventHandler(this.miReportBugs_Click);
            // 
            // tiStatistics
            // 
            this.tiStatistics.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.tiStatistics.BackColor = System.Drawing.Color.Transparent;
            this.tiStatistics.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tiStatistics.Image = ((System.Drawing.Image)(resources.GetObject("tiStatistics.Image")));
            this.tiStatistics.Location = new System.Drawing.Point(12, 178);
            this.tiStatistics.Name = "tiStatistics";
            this.tiStatistics.Size = new System.Drawing.Size(204, 16);
            this.tiStatistics.TabIndex = 5;
            this.tiStatistics.Text = "Statistics";
            this.tiStatistics.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.tiStatistics.UseVisualStyleBackColor = false;
            this.tiStatistics.Click += new System.EventHandler(this.tiStatistics_Click);
            // 
            // tiAbout
            // 
            this.tiAbout.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.tiAbout.BackColor = System.Drawing.Color.Transparent;
            this.tiAbout.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tiAbout.Image = global::QuickLoad.Images.About_16;
            this.tiAbout.Location = new System.Drawing.Point(12, 198);
            this.tiAbout.Name = "tiAbout";
            this.tiAbout.Size = new System.Drawing.Size(204, 16);
            this.tiAbout.TabIndex = 6;
            this.tiAbout.Text = "About";
            this.tiAbout.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.tiAbout.UseVisualStyleBackColor = false;
            this.tiAbout.Click += new System.EventHandler(this.tiAbout_Click);
            // 
            // expStatus
            // 
            this.expStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.expStatus.Animate = true;
            this.expStatus.AutoLayout = true;
            this.expStatus.CustomHeaderSettings.NormalGradientEndColor = System.Drawing.Color.White;
            this.expStatus.CustomHeaderSettings.NormalGradientStartColor = System.Drawing.Color.DarkOrange;
            this.expStatus.CustomHeaderSettings.SpecialGradientEndColor = System.Drawing.Color.White;
            this.expStatus.CustomHeaderSettings.SpecialGradientStartColor = System.Drawing.Color.DarkOrange;
            this.expStatus.CustomHeaderSettings.TitleFont = new System.Drawing.Font("Verdana", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.expStatus.CustomHeaderSettings.TitleGradient = true;
            this.expStatus.ExpandedHeight = 108;
            this.expStatus.Font = new System.Drawing.Font("Tahoma", 8.25F);
            this.expStatus.Items.AddRange(new System.Windows.Forms.Control[] {
            this.tiSpeed,
            this.tiDoShutdown});
            this.expStatus.Location = new System.Drawing.Point(7, 238);
            this.expStatus.Margin = new System.Windows.Forms.Padding(1);
            this.expStatus.Name = "expStatus";
            this.expStatus.Size = new System.Drawing.Size(228, 108);
            this.expStatus.TabIndex = 2;
            this.expStatus.Text = "Status";
            this.expStatus.TitleImage = ((System.Drawing.Image)(resources.GetObject("expStatus.TitleImage")));
            // 
            // tiSpeed
            // 
            this.tiSpeed.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.tiSpeed.BackColor = System.Drawing.Color.Transparent;
            this.tiSpeed.CustomSettings.FontDecoration = System.Drawing.FontStyle.Regular;
            this.tiSpeed.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tiSpeed.Image = ((System.Drawing.Image)(resources.GetObject("tiSpeed.Image")));
            this.tiSpeed.Location = new System.Drawing.Point(12, 58);
            this.tiSpeed.Name = "tiSpeed";
            this.tiSpeed.Size = new System.Drawing.Size(204, 16);
            this.tiSpeed.TabIndex = 5;
            this.tiSpeed.Text = "Speed: 0 kB/s";
            this.tiSpeed.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.tiSpeed.UseVisualStyleBackColor = false;
            // 
            // tiDoShutdown
            // 
            this.tiDoShutdown.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tiDoShutdown.ForeColor = System.Drawing.SystemColors.WindowText;
            this.tiDoShutdown.Location = new System.Drawing.Point(12, 78);
            this.tiDoShutdown.Name = "tiDoShutdown";
            this.tiDoShutdown.Size = new System.Drawing.Size(190, 20);
            this.tiDoShutdown.TabIndex = 2;
            this.tiDoShutdown.Text = "Shutdown PC when finished";
            // 
            // expView
            // 
            this.expView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.expView.Animate = true;
            this.expView.AutoLayout = true;
            this.expView.CustomHeaderSettings.NormalGradientEndColor = System.Drawing.Color.White;
            this.expView.CustomHeaderSettings.NormalGradientStartColor = System.Drawing.Color.DarkOrange;
            this.expView.CustomHeaderSettings.SpecialGradientEndColor = System.Drawing.Color.White;
            this.expView.CustomHeaderSettings.SpecialGradientStartColor = System.Drawing.Color.DarkOrange;
            this.expView.CustomHeaderSettings.TitleFont = new System.Drawing.Font("Verdana", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.expView.CustomHeaderSettings.TitleGradient = true;
            this.expView.ExpandedHeight = 104;
            this.expView.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.expView.Items.AddRange(new System.Windows.Forms.Control[] {
            this.tiClearList,
            this.tiRemoveCompleted});
            this.expView.Location = new System.Drawing.Point(7, 353);
            this.expView.Margin = new System.Windows.Forms.Padding(1);
            this.expView.Name = "expView";
            this.expView.Size = new System.Drawing.Size(228, 104);
            this.expView.TabIndex = 1;
            this.expView.Text = "View";
            this.expView.TitleImage = ((System.Drawing.Image)(resources.GetObject("expView.TitleImage")));
            // 
            // tiClearList
            // 
            this.tiClearList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.tiClearList.BackColor = System.Drawing.Color.Transparent;
            this.tiClearList.Enabled = false;
            this.tiClearList.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tiClearList.Image = ((System.Drawing.Image)(resources.GetObject("tiClearList.Image")));
            this.tiClearList.Location = new System.Drawing.Point(12, 58);
            this.tiClearList.Name = "tiClearList";
            this.tiClearList.Size = new System.Drawing.Size(204, 16);
            this.tiClearList.TabIndex = 0;
            this.tiClearList.Text = "Clear list";
            this.tiClearList.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.tiClearList.UseVisualStyleBackColor = false;
            // 
            // tiRemoveCompleted
            // 
            this.tiRemoveCompleted.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.tiRemoveCompleted.BackColor = System.Drawing.Color.Transparent;
            this.tiRemoveCompleted.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tiRemoveCompleted.Image = ((System.Drawing.Image)(resources.GetObject("tiRemoveCompleted.Image")));
            this.tiRemoveCompleted.Location = new System.Drawing.Point(12, 78);
            this.tiRemoveCompleted.Name = "tiRemoveCompleted";
            this.tiRemoveCompleted.Size = new System.Drawing.Size(204, 16);
            this.tiRemoveCompleted.TabIndex = 1;
            this.tiRemoveCompleted.Text = "Remove completed tasks";
            this.tiRemoveCompleted.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.tiRemoveCompleted.UseVisualStyleBackColor = false;
            this.tiRemoveCompleted.Click += new System.EventHandler(this.miRemoveUploaded_Click);
            // 
            // expRecentFiles
            // 
            this.expRecentFiles.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.expRecentFiles.Animate = true;
            this.expRecentFiles.AutoLayout = true;
            this.expRecentFiles.CustomHeaderSettings.NormalGradientEndColor = System.Drawing.Color.White;
            this.expRecentFiles.CustomHeaderSettings.NormalGradientStartColor = System.Drawing.Color.DarkOrange;
            this.expRecentFiles.CustomHeaderSettings.SpecialGradientEndColor = System.Drawing.Color.White;
            this.expRecentFiles.CustomHeaderSettings.SpecialGradientStartColor = System.Drawing.Color.DarkOrange;
            this.expRecentFiles.CustomHeaderSettings.TitleFont = new System.Drawing.Font("Verdana", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.expRecentFiles.CustomHeaderSettings.TitleGradient = true;
            this.expRecentFiles.ExpandedHeight = 3472;
            this.expRecentFiles.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.expRecentFiles.Items.AddRange(new System.Windows.Forms.Control[] {
            this.tiRecentReplays,
            this.pRecentFilesHint,
            this.tiRefreshRecentFiles});
            this.expRecentFiles.Location = new System.Drawing.Point(7, 464);
            this.expRecentFiles.Name = "expRecentFiles";
            this.expRecentFiles.Size = new System.Drawing.Size(228, 3472);
            this.expRecentFiles.TabIndex = 3;
            this.expRecentFiles.Text = "Recent files";
            this.expRecentFiles.TitleImage = ((System.Drawing.Image)(resources.GetObject("expRecentFiles.TitleImage")));
            // 
            // tiRecentReplays
            // 
            this.tiRecentReplays.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.tiRecentReplays.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.RecRepName,
            this.RecRepDate});
            this.tiRecentReplays.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tiRecentReplays.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tiRecentReplays.FullRowSelect = true;
            listViewGroup7.Header = "Screenshots";
            listViewGroup7.Name = "lvgScreenshots";
            listViewGroup8.Header = "Replays";
            listViewGroup8.Name = "lvgReplays";
            listViewGroup9.Header = "Aequitas";
            listViewGroup9.Name = "lvgAequitas";
            this.tiRecentReplays.Groups.AddRange(new System.Windows.Forms.ListViewGroup[] {
            listViewGroup7,
            listViewGroup8,
            listViewGroup9});
            this.tiRecentReplays.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
            this.tiRecentReplays.Location = new System.Drawing.Point(0, 48);
            this.tiRecentReplays.Name = "tiRecentReplays";
            this.tiRecentReplays.Size = new System.Drawing.Size(228, 3317);
            this.tiRecentReplays.TabIndex = 0;
            this.tiRecentReplays.UseCompatibleStateImageBehavior = false;
            this.tiRecentReplays.View = System.Windows.Forms.View.Details;
            this.tiRecentReplays.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.tiRecentReplays_MouseDoubleClick);
            this.tiRecentReplays.Resize += new System.EventHandler(this.tiRecentReplays_Resize);
            this.tiRecentReplays.ItemMouseHover += new System.Windows.Forms.ListViewItemMouseHoverEventHandler(this.tiRecentReplays_ItemMouseHover);
            this.tiRecentReplays.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.tiRecentReplays_ItemDrag);
            // 
            // RecRepName
            // 
            this.RecRepName.Text = "Name";
            this.RecRepName.Width = 115;
            // 
            // RecRepDate
            // 
            this.RecRepDate.Text = "Date";
            this.RecRepDate.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.RecRepDate.Width = 77;
            // 
            // pRecentFilesHint
            // 
            this.pRecentFilesHint.Controls.Add(this.bRecentFilesHintDismiss);
            this.pRecentFilesHint.Controls.Add(this.lRecentFilesHint);
            this.pRecentFilesHint.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.pRecentFilesHint.Location = new System.Drawing.Point(0, 3365);
            this.pRecentFilesHint.Name = "pRecentFilesHint";
            this.pRecentFilesHint.Size = new System.Drawing.Size(228, 107);
            this.pRecentFilesHint.TabIndex = 1;
            // 
            // bRecentFilesHintDismiss
            // 
            this.bRecentFilesHintDismiss.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.bRecentFilesHintDismiss.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.bRecentFilesHintDismiss.Location = new System.Drawing.Point(150, 83);
            this.bRecentFilesHintDismiss.Name = "bRecentFilesHintDismiss";
            this.bRecentFilesHintDismiss.Size = new System.Drawing.Size(75, 23);
            this.bRecentFilesHintDismiss.TabIndex = 0;
            this.bRecentFilesHintDismiss.Text = "Dismiss";
            this.bRecentFilesHintDismiss.UseVisualStyleBackColor = true;
            this.bRecentFilesHintDismiss.Click += new System.EventHandler(this.bRecentFilesHintDismiss_Click);
            // 
            // lRecentFilesHint
            // 
            this.lRecentFilesHint.BackColor = System.Drawing.SystemColors.Control;
            this.lRecentFilesHint.Dock = System.Windows.Forms.DockStyle.Fill;
            this.lRecentFilesHint.Location = new System.Drawing.Point(0, 0);
            this.lRecentFilesHint.Name = "lRecentFilesHint";
            this.lRecentFilesHint.Size = new System.Drawing.Size(228, 107);
            this.lRecentFilesHint.TabIndex = 1;
            this.lRecentFilesHint.Text = "Hint: You can easily preview the files you want to upload by either doubleclickin" +
                "g them in the \'Recent files\' list above or in the \'Queue\' list on the right.";
            // 
            // tiRefreshRecentFiles
            // 
            this.tiRefreshRecentFiles.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.tiRefreshRecentFiles.BackColor = System.Drawing.Color.Transparent;
            this.tiRefreshRecentFiles.FlatAppearance.BorderColor = System.Drawing.Color.Green;
            this.tiRefreshRecentFiles.Image = ((System.Drawing.Image)(resources.GetObject("tiRefreshRecentFiles.Image")));
            this.tiRefreshRecentFiles.Location = new System.Drawing.Point(12, 3446);
            this.tiRefreshRecentFiles.Name = "tiRefreshRecentFiles";
            this.tiRefreshRecentFiles.Size = new System.Drawing.Size(204, 16);
            this.tiRefreshRecentFiles.TabIndex = 3;
            this.tiRefreshRecentFiles.Text = "Refresh recent files";
            this.tiRefreshRecentFiles.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.tiRefreshRecentFiles.UseVisualStyleBackColor = false;
            this.tiRefreshRecentFiles.Click += new System.EventHandler(this.tiRefreshRecentFiles_Click);
            // 
            // label1
            // 
            this.label1.BackColor = System.Drawing.SystemColors.Window;
            this.label1.Font = new System.Drawing.Font("Verdana", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.Image = ((System.Drawing.Image)(resources.GetObject("label1.Image")));
            this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.label1.Location = new System.Drawing.Point(12, 39);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(100, 49);
            this.label1.TabIndex = 0;
            this.label1.Text = "Speed:";
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // FormMain
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.BackColor = System.Drawing.SystemColors.Control;
            this.ClientSize = new System.Drawing.Size(929, 457);
            this.Controls.Add(this.MenuSizer);
            this.Controls.Add(this.splitContainer1);
            this.Controls.Add(this.taskPane1);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "FormMain";
            this.Text = "quickLoad";
            this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormMain_FormClosed);
            this.Resize += new System.EventHandler(this.FormMain_Resize);
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormMain_FormClosing);
            this.LocationChanged += new System.EventHandler(this.FormMain_LocationChanged);
            this.Load += new System.EventHandler(this.FormMain_Load);
            this.FileMenu.ResumeLayout(false);
            this.splitContainer1.Panel1.ResumeLayout(false);
            this.splitContainer1.Panel2.ResumeLayout(false);
            this.splitContainer1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.BigImage)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.table1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.taskPane1)).EndInit();
            this.taskPane1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.expTasks)).EndInit();
            this.expTasks.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.expStatus)).EndInit();
            this.expStatus.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.expView)).EndInit();
            this.expView.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.expRecentFiles)).EndInit();
            this.expRecentFiles.ResumeLayout(false);
            this.pRecentFilesHint.ResumeLayout(false);
            this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// Der Haupteinstiegspunkt fr die Anwendung.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.EnableVisualStyles();
			Application.Run(new FormMain());
		}

		private void setLanguage()
		{
			columnModel1.Columns[1].Text = lang.GetString("Name",culture);
			columnModel1.Columns[2].Text = lang.GetString("Type",culture);
			columnModel1.Columns[3].Text = lang.GetString("Size",culture);
			columnModel1.Columns[4].Text = lang.GetString("Status",culture);
			columnModel1.Columns[5].Text = lang.GetString("Progress",culture);
			columnModel1.Columns[6].Text = lang.GetString("Speed",culture);
			columnModel1.Columns[7].Text = lang.GetString("TimeRemaining",culture);
			table1.NoItemsText = lang.GetString("ListEmpty",culture);

			tiSettings.Text = lang.GetString("Settings",culture);
            miSettings.Text = lang.GetString("Settings", culture);
			expView.Text = lang.GetString("View",culture);
			tiRemoveCompleted.Text = lang.GetString("RemoveUploaded",culture);
            miRemoveUploaded.Text = lang.GetString("RemoveUploaded", culture);

            tiSpeed.Text = String.Format(lang.GetString("UploadSpeedText", culture), 0, ((char)8734).ToString());

			tiStartUpload.Text = lang.GetString("StartUpload",culture);
            miStartUpload.Text = lang.GetString("StartUpload", culture);
			tiShowLog.Text = lang.GetString("ShowLog",culture);
            miShowLog.Text = lang.GetString("ShowLog", culture);
			miUploadStats.Text = lang.GetString("UploadStatistics",culture);
            tiStatistics.Text = lang.GetString("UploadStatistics", culture);
			tiReportBugs.Text = lang.GetString("ReportBug",culture);
			miExit2.Text = lang.GetString("Exit",culture);
            tiAbout.Text = lang.GetString("About", culture);
            expRecentFiles.Text = lang.GetString("RecentFiles", culture);
            tiRefreshRecentFiles.Text = lang.GetString("RefreshRecent", culture);
            expTasks.Text = lang.GetString("Tasks", culture);
            lRecentFilesHint.Text = lang.GetString("RecentFilesHint", culture);
            tiUploadAssistant.Text = lang.GetString("UploadAssistant", culture);
            tiRecentReplays.Columns[1].Text = lang.GetString("Date", culture);
            tiDoShutdown.Text = QuickLoad.lang.ShutdownPC;
            tiClearList.Text = QuickLoad.lang.ClearList;
			
            tiSuccessfulFileList.Text = QuickLoad.lang.ShowULFiles;
			//settings.groupBox2.Text = lang.GetString("Appearance",culture);
			//settings.cbShowDropTarget.Text = lang.GetString("Settings.DragDrop",culture);
			
			data.Text = lang.GetString("Login.Title",culture);
			data.saveLogin.Text = lang.GetString("RememberPassword",culture);
		}
	    
	    public void RefreshSettings()
	    {
	        taskPane1.SuspendLayout();
            expRecentFiles.ExpandedHeight = QuickLoad.Properties.Settings.Default.RecentFilesHeight;

            foreach (Expando expando in taskPane1.Expandos)
            {
                if (QuickLoad.Properties.Settings.Default.ExpandosHidden.Contains(expando.Name))
                    expando.Hide();
                else 
                    expando.Show();
            }

            foreach (Expando expando in taskPane1.Expandos)
            {
                if (QuickLoad.Properties.Settings.Default.ExpandosCollapsed != null && QuickLoad.Properties.Settings.Default.ExpandosCollapsed.Contains(expando.Name) && expando.Visible)
                    expando.Collapse();
                else 
                    expando.Expand();
                foreach (Control c in expando.Items)
                {
                    if(QuickLoad.Properties.Settings.Default.ExpandoItemsHidden.Contains(c.Name))
                        expando.HideControl(c);
                    else 
                        expando.ShowControl(c);
                }
            }


            taskPane1.Visible = QuickLoad.Properties.Settings.Default.MenuBarEnabled;
            MenuSizer.SplitPosition = QuickLoad.Properties.Settings.Default.MenuBarWidth;
	        taskPane1.ResumeLayout();
            //taskPane1.Refresh();
	    }

		private void FormMain_Load(object sender, EventArgs e)
		{
            if (QuickLoad.Properties.Settings.Default.ShowSplash)
            {
                FormSplash sp = new FormSplash(this);
                sp.Show();
            }
		    //QuickLoad.Properties.Settings.Default.GetPreviousVersion()
            if (QuickLoad.Properties.Settings.Default.SettingsUpgradeNeccessary)
            {
                QuickLoad.Properties.Settings.Default.Upgrade();
                QuickLoad.Properties.Settings.Default.SettingsUpgradeNeccessary = false;
            }
            if (QuickLoad.Properties.Settings.Default.PseudoUniqueID == string.Empty)
            {
                char[] symbols = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
                Random r = new Random();
                while (QuickLoad.Properties.Settings.Default.PseudoUniqueID.Length < 20)
                    QuickLoad.Properties.Settings.Default.PseudoUniqueID += symbols[r.Next(62)];
            }
            QuickLoad.Properties.Settings.Default.Save();
            SuspendLayout();
            tooltip = new Controls.PreviewToolTip(this);
            tooltip.ImageClicked += new QuickLoad.Controls.PreviewToolTip.ImageClickedEventHandler(tooltip_ImageClicked);
            tooltip.VisibleChanged += new EventHandler(tooltip_VisibleChanged);
		    //Cursor cs = new Cursor("Zoom.ico");
            //ToolTipImage.Cursor = cs;
            Text = Application.ProductName + " " + Application.ProductVersion;// +" brought to you by Lucas";
            rm = new ResourceManager("QuickLoad.Resource1",
                this.GetType().Assembly);
            lang = new ResourceManager("QuickLoad.lang",
                this.GetType().Assembly);
            if (CultureInfo.CurrentCulture.Name != "de-DE")
            {
                culture = CultureInfo.CreateSpecificCulture("");
            }
            else
            {
                culture = CultureInfo.CurrentCulture;
            }
            
            setLanguage();
            RefreshSettings();
		    Width = QuickLoad.Properties.Settings.Default.FormWidth;
		    Height = QuickLoad.Properties.Settings.Default.FormHeight;
            Location = QuickLoad.Properties.Settings.Default.FormPos;
            tiRecentReplays.Columns[0].Width = QuickLoad.Properties.Settings.Default.ColumnNameWidth;
            tiRecentReplays.Columns[1].Width = QuickLoad.Properties.Settings.Default.ColumnDateWidth;

            foreach (string s in QuickLoad.Properties.Settings.Default.ExpandoOrder)
		    {
		        foreach (Expando expando in taskPane1.Controls)
		        {
                    if (expando.Name == s)
                    {
                        taskPane1.Expandos.MoveToBottom(expando);
                        break;
                    }
		        }
		    }
            
		    //got to set this AFTER language selection, because we identify the Columns by title, which is language-dependent
		    foreach (Column c in columnModel1.Columns)
		    {
                if (QuickLoad.Properties.Settings.Default.InvisibleColumns.Contains(c.Text))
                    c.Visible = false;
		    }
            tiRefreshRecentFiles.Dock = DockStyle.Bottom;
            ResumeLayout();
            if (QuickLoad.Properties.Settings.Default.AutoCheckForUpdates && QuickLoad.Properties.Settings.Default.LastUpdateCheck.Date != DateTime.Now.Date)
            {
                upd.UpdateCheckComplete += new AutoUpdater.AutoUpdateChecker.UpdateCheckCompleteEventHandler(upd_UpdateCheckComplete);
                upd.hasUpdateAsync(QuickLoad.Properties.Settings.Default.AutoUpdateURL,
                              new Version(Application.ProductVersion), new AutoUpdater.UsageInfo(QuickLoad.Properties.Settings.Default.PseudoUniqueID, Application.ProductVersion));
            }
            ScanFolders();
            
            
			//LoadRecentMatches();
		//	UI.FormDrop fd = new FormDrop(this);
		//	if (settings.sDropTarget.CurrentValue == "1")
		//		fd.Show();
		    
		}

        internal void upd_UpdateCheckComplete(AutoUpdater.AutoUpdateChecker sender, AutoUpdater.UpdateCheckEventArgs e)
        {
            if (e.hasUpdate)
                if (MessageBox.Show(QuickLoad.lang.UpdateAvailable, QuickLoad.lang.UpdateAvailableTitle, MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    using (FormUpdate fupd = new FormUpdate(sender))
                        fupd.ShowDialog(this);
                }
            QuickLoad.Properties.Settings.Default.LastUpdateCheck = DateTime.Now;
        }

        void tooltip_VisibleChanged(object sender, EventArgs e)
        {
            timerImageHide_Tick(sender,e);
        }

        void tooltip_ImageClicked(object sender, QuickLoad.Controls.ImageClickedEventArgs e)
        {
            SuspendLayout();
            BigImage.Dock = DockStyle.Fill;
            BigImage.Visible = true;
            if (BigImage.Height <= BigImage.Width * 0.75/1)
                BigImage.Image =
                    Image.FromFile(e.ImagePath).GetThumbnailImage(BigImage.Height * 4 / 3, BigImage.Height,
                                                                            new Image.GetThumbnailImageAbort(
                                                                                nixx), new IntPtr(0));
            else
                BigImage.Image =
                        Image.FromFile(e.ImagePath).GetThumbnailImage(BigImage.Width, BigImage.Width * 3 / 4,
                                                                                new Image.GetThumbnailImageAbort(
                                                                                    nixx), new IntPtr(0));
            //BigImage.BringToFront();

            table1.Visible = false;
            //timerImageHide.Stop();
            //timerImageHide.Interval = QuickLoad.Properties.Settings.Default.ImageShowTimeout;
            //timerImageHide.Start();
            ResumeLayout();
        }


	    private void ScanFolders()
        {
            if(QuickLoad.Properties.Settings.Default.watchedFolders == null)
                return;
	        tiRecentReplays.SuspendLayout();
            tiRecentReplays.Items.Clear();
            int FileCount=0;
            foreach (string s in QuickLoad.Properties.Settings.Default.watchedFolders)
            {
                DirectoryInfo d = new DirectoryInfo(s);
                if (!d.Exists)
                    continue;
                FileCount += d.GetFiles().Length;
            }
            FileInfo[] fi = new FileInfo[FileCount];
            FileCount = 0;
            foreach (string s in QuickLoad.Properties.Settings.Default.watchedFolders)
            {
                DirectoryInfo d = new DirectoryInfo(s);
                if (!d.Exists)
                    continue;
                FileInfo[] fi2 = d.GetFiles();
                foreach (FileInfo f in fi2)
                {
                    fi[FileCount] = f;
                    FileCount++;
                }
                //FileCount += d.GetFiles().Length;
            }
            Array.Sort(fi,new CompareFileInfo());
            Array.Reverse(fi);
            foreach (FileInfo info in fi)
            {
                ListViewItem i = new ListViewItem();
                i.Text = Path.GetFileNameWithoutExtension(info.Name);
                i.SubItems[0].Tag = info.FullName;
                if (info.LastWriteTime.Date == DateTime.Today)
                    i.SubItems.Add(lang.GetString("Today", culture) + info.LastWriteTime.ToString(" HH:mm", CultureInfo.CurrentCulture.DateTimeFormat));
                else if (info.LastWriteTime.Date == DateTime.Today.Subtract(new TimeSpan(1,0,0,0,0)))
                    i.SubItems.Add(lang.GetString("Yesterday", culture) + info.LastWriteTime.ToString(" HH:mm", CultureInfo.CurrentCulture.DateTimeFormat));
                else
                    i.SubItems.Add(info.LastWriteTime.ToString("dd.MM. HH:mm", CultureInfo.CurrentCulture.DateTimeFormat));
                i.SubItems[i.SubItems.Count-1].Tag = info.LastWriteTime;
                if (Helpers.getGameFileType(info.FullName) == GameFileType.Replay &&
                    tiRecentReplays.Groups["lvgReplays"].Items.Count < QuickLoad.Properties.Settings.Default.ReplayCount)
                    {
                        i.ImageIndex = 1; //Demo
                        i.Group = tiRecentReplays.Groups["lvgReplays"];
                        tiRecentReplays.Items.Add(i);
                    }
                    else if (Helpers.getGameFileType(info.FullName) == GameFileType.Screenshot &&
                    tiRecentReplays.Groups["lvgScreenshots"].Items.Count < QuickLoad.Properties.Settings.Default.ScreenshotCount)
                    {
                        i.ImageIndex = 0; //Screenshot
                        tiRecentReplays.Items.Add(i);
                        i.Group = tiRecentReplays.Groups["lvgScreenshots"];
                    }
                    else if (Helpers.getGameFileType(info.FullName) == GameFileType.Aequitas &&
                        tiRecentReplays.Groups["lvgAequitas"].Items.Count < QuickLoad.Properties.Settings.Default.AequitasCount)
                    {
                        i.ImageIndex = 6; //zip
                        tiRecentReplays.Items.Add(i);
                        i.Group = tiRecentReplays.Groups["lvgAequitas"];
                    }
            }
	        tiRecentReplays.ResumeLayout();
        }

        
		
		private void SwitchStatus(bool uploading)
		{
			this.uploading = uploading;
			if (uploading)
			{
				table1.AllowDrop=false;
				//sBar.Visible = true;
				//sBar.Panels[0].Text = "Idle";
				miStartUpload.Visible = false;
				miCancelUpload.Visible = true;
				//panelProgress.Visible = true;
				uptimer.Enabled = true;
			}
			else
			{
				//panelProgress.Visible = false;
				//sBar.Visible = false;
				miStartUpload.Visible = true;
				miCancelUpload.Visible = false;
				table1.AllowDrop=true;
				this.Invalidate();
			}
		}

		internal void AddRow(Row row)
		{
			tableModel1.Rows.Add(row);
		}


		

	

		internal string ConvertBytes(long Bytes) 
		{ 
			if (Bytes >= 1073741824) 
			{ 
				return Convert.ToString(Math.Round((Double)(Bytes / 1024 / 1024 / 1024), 2)) + " GB"; 
			} 
			else if (Bytes >= 1048576) 
			{ 
				return Convert.ToString(Math.Round((Double)(Bytes / 1024 / 1024), 2)) + " MB"; 
			} 
			else if (Bytes >= 1024) 
			{ 
				return Convert.ToString(Math.Round((Double)(Bytes / 1024),2)) + " KB"; 
			} 
			else if (Bytes > 0 & Bytes < 1024) 
			{ 
				return Convert.ToString(Bytes) + " Bytes"; 
			} 
			else 
			{ 
				return "0 Bytes"; 
			} 
		}

		internal string getType(String path)
		{
			string type="null";
			string ext = Path.GetExtension(path).ToLower();
			switch(ext) 
			{
				case ".jpg":	type = "Screenshot (compressed)";
					break;
				case ".bmp":	type = "Screenshot";
					break;
				case ".dem":	type = "Replay";
					break;
                case ".zip": if (!Helpers.isAequitasFile(path))
                                type = "ZIP-Archive";
                             else
                                type = "Aequitas";
					break;
			}
			return type;
		}

		internal int getItemIndex(String ext)
		{
			int index=-1;
			ext = ext.ToLower();
			switch(ext) {
				case ".jpg":	index = 5;
								break;
				case ".bmp":	index = 0;
								break;
				case ".dem":	index = 1;
								break;
				case ".zip":	index = 6;
					break;
			}
			return index;
		}

		private void FormMain_Resize(object sender, EventArgs e)
		{
			this.Invalidate();
		}


		private void miExit_Click(object sender, EventArgs e)
		{
			Close();
		}

		/*private void miSwitch_Click(object sender, System.EventArgs e)
		{
			SwitchForm();
		}*/
	/*	private void SwitchForm()
		{
			//panelDrop.Visible = !panelDrop.Visible;
			table1.Visible = !table1.Visible;
			if (table1.Visible)
			{
				this.FormBorderStyle = FormBorderStyle.Sizable;
				this.SavedPosition1.X = Left;
				this.SavedPosition1.Y = Top;
				this.Left = SavedPosition2.X;
				this.Top = SavedPosition2.Y;
				this.Height = SavedHeight;
				this.Width = SavedWidth;
				this.Opacity = 1;
				this.TopMost = false;
				this.ShowInTaskbar = true;
				this.Activate();
			}
			else
			{
				this.Opacity = 0.6;
				this.FormBorderStyle = FormBorderStyle.None;
				this.SavedPosition2.X = Left;
				this.SavedPosition2.Y = Top;
				this.Left = SavedPosition1.X;
				this.Top = SavedPosition1.Y;
				this.Height = 100;
				this.Width = 100;
				this.ShowInTaskbar = false;
				this.TopMost = true;
			}
		}*/

		private void FormMain_LocationChanged(object sender, EventArgs e)
		{
	/*		int offset=20;
			if (this.Right > Screen.PrimaryScreen.WorkingArea.Right-offset)
			{
				this.Left = Screen.PrimaryScreen.WorkingArea.Right-this.Width;
			}
			if (this.Left < Screen.PrimaryScreen.WorkingArea.Left+offset)
			{
				this.Left = Screen.PrimaryScreen.WorkingArea.Left;
			}	*/
		}

		private void FileList_KeyDown(object sender, KeyEventArgs e)
		{
			ListView lw = (ListView)sender;
			
			if (e.KeyCode == Keys.Up)
			{
				if ((lw.SelectedItems.Count == 1) && (lw.SelectedItems[0].Index > 0))
				{
					ListViewItem lwi = lw.SelectedItems[0];
					int newindex = lwi.Index-1;
					lw.Items.RemoveAt(lwi.Index);
					lw.Items.Insert(newindex,lwi);
				}
				e.Handled = true;
			}
			else if (e.KeyCode == Keys.Down)
			{
				if ((lw.SelectedItems.Count == 1) && (lw.SelectedItems[0].Index < lw.Items.Count-1))
				{
					ListViewItem lwi = lw.SelectedItems[0];
					int newindex = lwi.Index+1;
					lw.Items.RemoveAt(lwi.Index);
					lw.Items.Insert(newindex,lwi);
				}
				e.Handled = true;
			}
			else if (e.KeyCode == Keys.Delete)
			{
				if (lw.SelectedItems.Count == 1)
				{
					//RemoveItem(lw.SelectedItems[0]);
				}
				e.Handled = true;
			}
		}
        
		private void miStartUpload_Click(object sender, EventArgs e)
		{
			data.ShowDialog(this);
			
			if (data.DialogResult == DialogResult.OK)
			{
                up = new Uploader(QuickLoad.Properties.Settings.Default.Cookie, data.tbMatch.Text);
                up.MaxConnections = QuickLoad.Properties.Settings.Default.UpMaxConnections;
                up.MaxPreloads = QuickLoad.Properties.Settings.Default.UpMaxPreloads;
                up.MaxRetries = QuickLoad.Properties.Settings.Default.UpMaxRetries;
				SwitchStatus(true);
				//CurItem = 0;
				match = data.tbMatch.Text;
				foreach (Row row in tableModel1.Rows)
				{
					if (row.Cells[4].Text != up.lang.GetString("Upload finished",culture))
					{
						if ((string)row.Cells[2].Data == String.Empty)
						{
							UncompressedFile norm = new UncompressedFile((string)row.Cells[1].Data,row.Cells[1].Text);
							up.AddFile(norm);
                            row.Tag = norm;
						}
						/*else
						{
							CompressedFile zip = new CompressedFile((string)row.Cells[2].Data,(string)row.Cells[1].Data,row.Cells[1].Text);
							up.AddFile(zip);
						}*/
					}
				}
				up.Start();
				uptimer.Enabled=true;
                tiStartUpload.Text = lang.GetString("StopUpload", culture);
                tiStartUpload.Click -= new System.EventHandler(this.miStartUpload_Click);
                tiStartUpload.Click += new System.EventHandler(this.miCancelUpload_Click);
                tiStartUpload.CustomSettings.LinkColor = Color.Red;
			}
		}

		private void uptimer_Tick(object sender, EventArgs e)
		{
            string timeleft = string.Empty;
            int asc = 8734; //infinite
            char c = (char) asc;
            if (up.TimeLeft == TimeSpan.Zero)
                timeleft = c.ToString();
            else
                timeleft = up.TimeLeft.ToString();
		    tiSpeed.Text = String.Format(lang.GetString("UploadSpeedText",culture),Math.Round(up.Speed/1000,2),timeleft);
			table1.BeginUpdate();
			foreach (Row row in tableModel1.Rows)
			{
				if (row.Cells[4].Text != up.lang.GetString("Upload finished",culture))
				{
                    UploadFile upfile = (UploadFile)row.Tag;//up.GetByFullname((string)row.Cells[1].Data);
					//XPTable.Editors.CellEditor ed = new XPTable.Editors.CellEditor();
					if (upfile.Status == ItemUploadStatus.Queued)
					{
						row.Cells[0].Image = (Image)rm.GetObject("Queued");
					}
					else if (upfile.Status == ItemUploadStatus.Converting)
					{
						row.Cells[0].Image = (Image)rm.GetObject("Compressing");
					}
					else if (upfile.Status == ItemUploadStatus.Converted)
					{
						row.Cells[0].Image = (Image)rm.GetObject("Waiting");
					}
					else if (upfile.Status == ItemUploadStatus.Failed || upfile.Status == ItemUploadStatus.Aborted)
					{
						row.Cells[0].Image = (Image)rm.GetObject("Failed");
					}
					else if (upfile.Status == ItemUploadStatus.Uploading)
					{
						row.Cells[0].Image = (Image)rm.GetObject("Uploading");
					}
					else if (upfile.Status == ItemUploadStatus.Uploaded)
					{
						row.Cells[0].Image = (Image)rm.GetObject("Waiting");
					}
					else if (upfile.Status == ItemUploadStatus.FinishedSuccessful)
					{
						row.Cells[0].Image = (Image)rm.GetObject("Finished");
					}
                    row.Cells[3].Text = Helpers.getFormattedKiloBytes(upfile.FileSize) + " kB";
					row.Cells[4].Text = upfile.StatusString;
					row.Cells[5].Data = upfile.Progress;

					if (upfile.Status == ItemUploadStatus.Converting || upfile.Status == ItemUploadStatus.Uploading)
					{
                        row.Cells[6].Text = Math.Round(upfile.Speed / 1000, 2).ToString() + " kB/s";
					}
					else
					{
						row.Cells[6].Text = string.Empty;
                        
					}

					string tr;
                    if (upfile.TimeRemaining(upfile.Speed) == TimeSpan.Zero)
                    {
                        tr = ((char)8734).ToString();
                        row.Cells[7].Font = new Font(row.Cells[7].Font.Name, 12);
                    }
                    else
                    {
                        tr = upfile.TimeRemaining(upfile.Speed).ToString();
                        row.Cells[7].Font = new Font(row.Cells[7].Font.Name, 8);
                    }
					row.Cells[7].Text = tr;
				}
				

			}
			table1.EndUpdate();
			if (up.Status != UploadStatus.Running)
			{
				UploadFinished();
			}
		}
		private void UploadFinished()
		{
            tiStartUpload.Text = lang.GetString("StartUpload", culture);
            tiStartUpload.CustomSettings.LinkColor = Color.LimeGreen;
            tiStartUpload.Click -= new System.EventHandler(this.miCancelUpload_Click);
            tiStartUpload.Click += new System.EventHandler(this.miStartUpload_Click);
            QuickLoad.Properties.Settings.Default.ReplaysUploaded += up.UploadedDemoCount;
            QuickLoad.Properties.Settings.Default.ScreenshotsUploaded += up.UploadedScreenshotCount;
            QuickLoad.Properties.Settings.Default.AequitasUploaded += up.UploadedAequitasCount;
            QuickLoad.Properties.Settings.Default.ReplayBytesUploaded += up.UploadedDemoBytes;
            QuickLoad.Properties.Settings.Default.ScreenshotBytesUploaded += up.UploadedScreenshotBytes;
            QuickLoad.Properties.Settings.Default.AequitasBytesUploaded += up.UploadedAequitasBytes;
			SwitchStatus(false);
			uptimer.Enabled = false;
			if (tiDoShutdown.Checked)
			{
				WindowsController.ExitWindows(RestartOptions.PowerOff,true);
			}
		}
/*		private void RemoveItem(ListViewItem item)
		{
			if (FileList.GetEmbeddedControl(5,FileList.Items.Count-1) != null)
			{
				FileList.RemoveEmbeddedControl(FileList.GetEmbeddedControl(5,FileList.Items.Count-1));
			}
			FileList.Items.Remove(item);
		}*/


		private void FileMenu_Popup(object sender, EventArgs e)
		{
			if (tableModel1.Rows.Count > 0)
			{
				miStartUpload.Enabled = true;
			}
			else
			{
				miStartUpload.Enabled = false;
			}
		}

		private void miShowLog_Click(object sender, EventArgs e)
		{
			/*try
			{
				System.Diagnostics.Process.Start("upload.log");
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message,"Error!");
			}*/
            FormLogViewer lw = null;
            if (up != null)
            {
                lw = new FormLogViewer(up);
                lw.Show(this);
            }
		    else
            {
                lw = new FormLogViewer("upload.log");
                lw.Show(this);
            }
                
		}

		/*private void panelDrop_DoubleClick(object sender, System.EventArgs e)
		{
			SwitchForm();
		}*/

		private void miReportBugs_Click(object sender, EventArgs e)
		{
			try
			{
				Process.Start("http://lucas.enterprising-developers.de/bugtracking/bug_report_page.php?product_version="+ Application.ProductVersion);
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message,"Error!");
			}
		}

		private void miSettings_Click(object sender, EventArgs e)
		{
            if (settings == null)
            {
                settings = new Settings(this, expRecentFiles, taskPane1);
                settings.Text = lang.GetString("Settings", culture);
                settings.gUploadSettings.Text = lang.GetString("UploadSettings", culture);
                settings.bCancel.Text = lang.GetString("Cancel", culture);
            }
			settings.ShowDialog(this);
		}


		internal void table1_DragEnter(object sender, DragEventArgs e)
		{
			if (e.Data.GetDataPresent(DataFormats.FileDrop)) 
				e.Effect = DragDropEffects.Copy;
			else
				e.Effect = DragDropEffects.None;
		}
		public static bool ThumbnailCallback()
		{
			return true;
		}

        

		internal void table1_DragDrop(object sender, DragEventArgs e)
		{
			Array a = (Array)e.Data.GetData(DataFormats.FileDrop);
			if (a != null)
			{
				if (table1.RowCount + a.Length > 10)
				{
					MessageBox.Show("You can't upload more than 10 items at once!");
					return;
				}
				for (int i=0;i<a.Length;i++)
				{
					string s = a.GetValue(i).ToString();
					String ext = Path.GetExtension(s).ToLower();
					if ((ext == ".bmp") || (ext == ".jpg") || (ext == ".dem") || (ext == ".zip"))
					{
						//ListViewItem item = new ListViewItem(Path.GetFileNameWithoutExtension(s),getItemIndex(ext));
						try
						{
                            Row row = CreateRow(s);
                            if (Helpers.isAequitasFile(s))
                            {
                                if(QuickLoad.Properties.Settings.Default.AequitasNames.Count > 0)
                                    row.Cells[1].Text = QuickLoad.Properties.Settings.Default.AequitasNames[0];
                                string matchlink = Helpers.getMatchlinkFromAequitasFile(s);
                                if (matchlink != string.Empty)
                                    data.tbMatch.Text = matchlink;
                            }
							tableModel1.Rows.Add(row);
						}
						catch (Exception ex)
						{
							MessageBox.Show(ex.Message);
						}
					}
					else
					{
						MessageBox.Show("Fileformat '" + ext + "' not supported!");
					}
				/*	else if (ext == ".zip")
					{
						FormBrowseZip zip = new FormBrowseZip(this,s);
						zip.Show();
					}*/
				}
				
			}
		}
	    
	    private Row CreateRow(string path)
	    {
            Row row = new Row();
            row.Cells.Add(new Cell(""));
            row.Cells[0].Image = (Image)rm.GetObject("Queued");
            row.Cells[0].ImageSizeMode = ImageSizeMode.ScaledToFit;
            row.Cells.Add(new Cell(Path.GetFileNameWithoutExtension(path)));
            row.Cells[1].Data = path;
            row.Cells[1].Editable = true;
            row.Cells.Add(new Cell(getType(path), (Image)rm.GetObject(Path.GetExtension(path).ToLower())));
            row.Cells[2].ImageSizeMode = ImageSizeMode.ScaledToFit;
            row.Cells[2].Data = String.Empty;
            FileInfo Datei = new FileInfo(path);
            row.Cells.Add(new Cell(Helpers.getFormattedKiloBytes(Datei.Length) + " kB"));
            row.Cells.Add(new Cell("Queued"));
            row.Cells.Add(new Cell(0));
            row.Cells.Add(new Cell(""));
            row.Cells.Add(new Cell(""));
	        return row;
	    }

		private void table1_BeginEditing(object sender, CellEditEventArgs e)
		{
            try
            {
			    if (e.Editor is ComboBoxCellEditor)
			    {
				    if (e.Column == 1)
                    {
                        
                        ((ComboBoxCellEditor)e.Editor).MaxDropDownItems = 10;
                        ((ComboBoxCellEditor)e.Editor).DropDownStyle = DropDownStyle.DropDown;
                        ((ComboBoxCellEditor)e.Editor).Items.Clear();
                        string ext = Path.GetExtension((string)e.Cell.Row.Cells[1].Data).ToLower();
                        if (ext == ".zip")
                        {
                            foreach (string s in QuickLoad.Properties.Settings.Default.AequitasNames)
                                ((ComboBoxCellEditor)e.Editor).Items.Add(s);
                            //((ComboBoxCellEditor) e.Editor).Items.AddRange(new string[] {"Round 1", "Round 2", "Round 3", "Round 4", "Aequitas"});
                        }
                        else if (ext == ".dem")
                        {
                            foreach (string s in QuickLoad.Properties.Settings.Default.DemoNames)
                                ((ComboBoxCellEditor)e.Editor).Items.Add(s);
                            //((ComboBoxCellEditor) e.Editor).Items.AddRange(new string[] {"Round 1", "Round 2", "Round 3", "Round 4"});
                        }
                        else if (ext == ".jpg" || ext == ".bmp")
                        {
                            foreach (string s in QuickLoad.Properties.Settings.Default.ScreenshotNames)
                                ((ComboBoxCellEditor)e.Editor).Items.Add(s);
                            //((ComboBoxCellEditor) e.Editor).Items.AddRange(new string[] {"Round 1", "Round 2", "Round 3", "Round 4", "Status"});
                        }
                        else
                        {
                            ((ComboBoxCellEditor)e.Editor).Items.AddRange(new string[] { "Round 1", "Round 2", "Round 3", "Round 4", "Status", "Aequitas" });
                        }
				    }
			    }
            }
            catch { }
		}

		private void table1_DoubleClick(object sender, EventArgs e)
		{
			if (table1.SelectedItems.Length < 1 || table1.SelectedItems[0].Cells[1].Selected)
			{
				return;
			}
			try
			{
				Row row = table1.SelectedItems[0];
				Process.Start((string)row.Cells[1].Data);
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message,"Error!");
			}
		}

		private void miRemoveUploaded_Click(object sender, EventArgs e)
		{
			Row[] rows = new Row[tableModel1.Rows.Count];
			int i=0;
			foreach (Row row in tableModel1.Rows)
			{
				if (up != null && row.Cells[4].Text == up.lang.GetString("Upload finished",culture))
				{
					rows[i] = row;
					i++;
				}
			}
			//if (tableModel1.Rows.Count > 0)
				tableModel1.Rows.RemoveRange(rows);
		}

		private void table1_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Delete)
			{
				if (table1.SelectedItems.Length == 1)
				{
					if (up != null && up.Status == UploadStatus.Running)
					{
                        ((UploadFile)table1.SelectedItems[0].Tag).Cancel();
					}
					table1.SelectedItems[0].TableModel.Rows.Remove(table1.SelectedItems[0]);
				}
			}
		}

		private void miCancelUpload_Click(object sender, EventArgs e)
		{
			up.Stop();
			SwitchStatus(false);
		}

		private void tiRecentReplays_ItemDrag(object sender, ItemDragEventArgs e)
		{
			string[] files = new string[tiRecentReplays.SelectedItems.Count];
			int i=0;
			foreach (ListViewItem li in tiRecentReplays.SelectedItems)
			{
				files[i] = (string)li.SubItems[0].Tag;
				i++;
			}
			if(tiRecentReplays.SelectedItems.Count > 0)
			{
				DoDragDrop(new DataObject(DataFormats.FileDrop, files), 
					DragDropEffects.Copy | 
					DragDropEffects.Move /* | 
                   DragDropEffects.Link */);
				//RefreshView();
			}
		}

        private void FormMain_FormClosed(object sender, FormClosedEventArgs e)
        {
            QuickLoad.Properties.Settings.Default.MenuBarWidth = MenuSizer.SplitPosition;
            QuickLoad.Properties.Settings.Default.FormWidth = Width;
            QuickLoad.Properties.Settings.Default.FormHeight = Height;
            QuickLoad.Properties.Settings.Default.FormPos = this.Location;
            QuickLoad.Properties.Settings.Default.ExpandosCollapsed.Clear();
            QuickLoad.Properties.Settings.Default.ColumnNameWidth = tiRecentReplays.Columns[0].Width;
            QuickLoad.Properties.Settings.Default.ColumnDateWidth = tiRecentReplays.Columns[1].Width;
            QuickLoad.Properties.Settings.Default.ShowRecentFilesHint = pRecentFilesHint.Visible;
            QuickLoad.Properties.Settings.Default.ExpandoOrder.Clear();
            foreach (Expando expando in taskPane1.Expandos)
            {
                QuickLoad.Properties.Settings.Default.ExpandoOrder.Add(expando.Name);
                if (expando.Collapsed)
                    QuickLoad.Properties.Settings.Default.ExpandosCollapsed.Add(expando.Name);
            }
            QuickLoad.Properties.Settings.Default.InvisibleColumns.Clear();
            foreach (Column c in columnModel1.Columns)
            {
                if (!c.Visible)
                    QuickLoad.Properties.Settings.Default.InvisibleColumns.Add(c.Text);
            }
            
            
            //last thing we do is save settings
            QuickLoad.Properties.Settings.Default.Save();
        }

        private void tiRecentReplays_Resize(object sender, EventArgs e)
        {
            //tiRecentReplays.AutoResizeColumn(2, ColumnHeaderAutoResizeStyle.ColumnContent);
            tiRecentReplays.Columns[0].Width = tiRecentReplays.Width - tiRecentReplays.Columns[1].Width - 18;
        }

        private void tiStatistics_Click(object sender, EventArgs e)
        {
            FormUploadStats f = new FormUploadStats();
            f.ShowDialog(this);
            f.Dispose();
        }

        private void tiRefreshRecentFiles_Click(object sender, EventArgs e)
        {
            ScanFolders();
        }

        private void tiAbout_Click(object sender, EventArgs e)
        {
            FormAbout a = new FormAbout(lang.GetString("About", culture) + " " + Application.ProductVersion.ToString());
            a.ShowDialog(this);
        }

        private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (up != null && up.Status == UploadStatus.Running && MessageBox.Show(lang.GetString("QuitQuestion", culture), lang.GetString("AreYouSure", culture), MessageBoxButtons.YesNo) == DialogResult.No)
                e.Cancel = true;
            else if (up != null)
            {
                up.Stop();
            }
        }

        private void tiRecentReplays_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            foreach (ListViewItem i in tiRecentReplays.SelectedItems)
            {
                try
                {
                    Process.Start((string)i.SubItems[0].Tag);
                }
                catch(Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error!");
                }
            }
        }

        private void bRecentFilesHintDismiss_Click(object sender, EventArgs e)
        {
            expRecentFiles.HideControl(pRecentFilesHint);
            QuickLoad.Properties.Settings.Default.ExpandoItemsHidden.Add(pRecentFilesHint.Name);
        }

        private void taskPane1_SizeChanged(object sender, EventArgs e)
        {
            expRecentFiles.ExpandedHeight = QuickLoad.Properties.Settings.Default.RecentFilesHeight;
        }

        private void taskPane1_VisibleChanged(object sender, EventArgs e)
        {
            foreach (Expando expando in taskPane1.Expandos)
            {
                if (QuickLoad.Properties.Settings.Default.ExpandosHidden != null && QuickLoad.Properties.Settings.Default.ExpandosHidden.Contains(expando.Name))
                {
                    //expando.Disabled = true;
                    //expando.Hide();
                    expando.Visible = false;
                }
                else
                    expando.Visible = true;
            }
        }
	    public void PopupUp(string path)
	    {
	        foreach (Control c in Controls)
	        {
	            c.Hide();
	        }
	        
	    }
	    
	    private bool nixx()
        {
            return false;
        }

        private void BigImage_Click(object sender, EventArgs e)
        {
            timerImageHide_Tick(sender,e);
        }

        private void timerImageHide_Tick(object sender, EventArgs e)
        {
            BigImage.Visible = false;
            table1.Visible = true;
            timerImageHide.Stop();
        }

        private void tiRecentReplays_ItemMouseHover(object sender, ListViewItemMouseHoverEventArgs e)
        {
            //PictureBox p = new PictureBox();
            tooltip.ShowToolTip((string)e.Item.SubItems[0].Tag, new Point(PointToClient(MousePosition).X + 10, PointToClient(MousePosition).Y), new Size(200, 150));
          
        }

        private void BigImage_DragEnter(object sender, DragEventArgs e)
        {
            timerImageHide_Tick(sender, e);
        }

        private void BigImage_MouseEnter(object sender, EventArgs e)
        {
            timerImageHide_Tick(sender, e);
        }

        private void BigImage_MouseMove(object sender, MouseEventArgs e)
        {
            timerImageHide_Tick(sender, e);
        }

        private void tiSuccessfulFileList_Click(object sender, EventArgs e)
        {
            FormLogViewer lw = new FormLogViewer("UploadedFiles.log");
            lw.Show(this);
        }
	}
    
    class CompareFileInfo : IComparer
    {
        public int Compare(object x, object y)
        {
            FileInfo file = (FileInfo)x;
            FileInfo file2 = (FileInfo)y;
            return DateTime.Compare(file.LastWriteTime, file2.LastWriteTime);
        }

    }
}
